using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Table
{
    /// <summary>
    /// <para>Pivot Table</para>
    /// <para>Creates a table from the input table by reducing redundancy  in records and flattening one-to-many relationships.</para>
    /// <para>通过减少记录中的冗余和展平一对多关系，从输入表创建表。</para>
    /// </summary>    
    [DisplayName("Pivot Table")]
    public class PivotTable : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public PivotTable()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para>The table whose records will be pivoted.</para>
        /// <para>将透视其记录的表。</para>
        /// </param>
        /// <param name="_fields">
        /// <para>Input Field(s)</para>
        /// <para>The fields that define records to be included in the output table.</para>
        /// <para>定义要包含在输出表中的记录的字段。</para>
        /// </param>
        /// <param name="_pivot_field">
        /// <para>Pivot Field</para>
        /// <para>The field whose record values are used to generate the field names in the output table.</para>
        /// <para>其记录值用于在输出表中生成字段名称的字段。</para>
        /// </param>
        /// <param name="_value_field">
        /// <para>Value Field</para>
        /// <para>The field whose values populate the pivoted fields in the output table.</para>
        /// <para>其值填充输出表中透视字段的字段。</para>
        /// </param>
        /// <param name="_out_table">
        /// <para>Output Table</para>
        /// <para>The table to be created.</para>
        /// <para>要创建的表。</para>
        /// </param>
        public PivotTable(object _in_table, List<object> _fields, object _pivot_field, object _value_field, object _out_table)
        {
            this._in_table = _in_table;
            this._fields = _fields;
            this._pivot_field = _pivot_field;
            this._value_field = _value_field;
            this._out_table = _out_table;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Pivot Table";

        public override string CallName => "management.PivotTable";

        public override List<string> AcceptEnvironments => ["configKeyword", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_table, _fields, _pivot_field, _value_field, _out_table];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The table whose records will be pivoted.</para>
        /// <para>将透视其记录的表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Input Field(s)</para>
        /// <para>The fields that define records to be included in the output table.</para>
        /// <para>定义要包含在输出表中的记录的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Field(s)")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _fields { get; set; }


        /// <summary>
        /// <para>Pivot Field</para>
        /// <para>The field whose record values are used to generate the field names in the output table.</para>
        /// <para>其记录值用于在输出表中生成字段名称的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Pivot Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _pivot_field { get; set; }


        /// <summary>
        /// <para>Value Field</para>
        /// <para>The field whose values populate the pivoted fields in the output table.</para>
        /// <para>其值填充输出表中透视字段的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Value Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _value_field { get; set; }


        /// <summary>
        /// <para>Output Table</para>
        /// <para>The table to be created.</para>
        /// <para>要创建的表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_table { get; set; }


        public PivotTable SetEnv(object configKeyword = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(configKeyword: configKeyword, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}